home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Go64!
/
Go64_1998-08_1998_CSW_Side_A.d64
/
scsi list 3
< prev
next >
Wrap
Text File
|
2023-02-26
|
13KB
|
352 lines
1000 rem ---------------------------------------------------------------------
1010 rem scsi listing 3
1020 rem basic 7.0 (c) by achim taege 1997
1030 rem ---------------------------------------------------------------------
1040 graphic 1,1
1050 fast:graphic 5,1
1060 print chr$(147);chr$(14) :rem screnn loeschen u. klein/gross
1070 bd=peek(186)
1080 dim ty$(8),se(27),pu(9)
1090 ty$(0)="Plattenlaufwerk":ty$(1)="Bandlaufwerk":ty$(3)="Drucker"
1100 ty$(4)="Worm-Platte":ty$(5)="CD-ROM":ty$(6)="Scanner"
1110 ty$(7)="Optischer-Speicher":ty$(8)="Medienwechsler"
1120 :
1130 for i=0 to 9:pu(i)=8192+256*i:next
1140 for i=0 to 79:l$=l$+" ":z$=z$+"-":next
1150 :
1160 dopen#1,"cd.ib.ascii.sys",u(bd)
1162 for i=0 to 255:get#1,a$:poke pu(9)+i,asc(a$):next
1164 dclose#1
1190 goto 60000 :rem zum hauptprg.
2000 rem ---------- scsi-kommando inquiry 6 byte -----------
2010 sc$=chr$(18)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(32)+chr$(0)
2020 gosub 4000:return :rem befehl senden
2030 :
2040 rem ---------- scsi-kommando test unit ready 6 byte ---
2050 sc$=chr$(0)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(0)+chr$(0)
2060 gosub 4000:return :rem befehl senden
2070 :
2080 rem ---------- scsi-kommando read capacity 10 byte -----
2090 sc$=chr$(37)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(0)
2100 sc$=sc$+chr$(0)+chr$(0)+chr$(0)+chr$(0)+chr$(0)
2110 gosub 4000:return :rem befehl senden
2120 :
2130 rem ---------- calc scsi block nummer ------------------
2140 nn=bn
2150 a3=int(nn/256^3):nn=nn-a3*256^3
2160 a2=int(nn/256^2):nn=nn-a2*256^2
2170 a1=int(nn/256) :a0=nn-a1*256
2180 return
2190 :
2200 rem ---------- read scsi block 10 byte -----------------
2210 gosub 2130 :rem calc block
2220 sc$=chr$(40)+chr$(lu*32)+chr$(a3)+chr$(a2)+chr$(a1)
2230 sc$=sc$+chr$(a0)+chr$(0)+chr$(0)+chr$(1)+chr$(0)
2240 gosub 4000:return :rem befehl senden
2250 :
3000 rem ---------- get byte aus puffer ---------------------
3010 bc=peek(pu+zt):bc$=chr$(peek(pu(9)+peek(pu+zt)))
3020 va=va+1:fe=0:if va>=ve then fe=1:return
3030 zt=zt+1:if zt=(bl-1) then bn=bn+1:gosub 2200:gosub 9000:zt=0
3040 return
3050 :
4000 rem ---------- scsi-kommando request sense 6 byte ------
4010 gosub 4110
4015 if fe=0 then begin :rem fe=0 kein request sense noetig
4020 : se=0:se(0)=0:se(2)=0:se(12)=0:se(13)=0:goto 6160
4022 bend
4025 se=fe
4030 sc$=chr$(3)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(27)+chr$(0)
4040 gosub 4110 :rem senden
4050 open 15,dv,15
4060 :print#15,"m-r"+chr$(ml)+chr$(mh)+chr$(14)
4070 :for f=0 to 13:get#15,a$:se(f)=asc(a$):next
4080 close 15
4090 goto 6160 :rem scsi error
4100 :
4110 rem ---------- send scsi-kommando -----------------------------
4120 gosub 4160
4130 if fe>0 then gosub 4160
4140 return
4150 :
4160 open 15,dv,15
4170 :print#15,"s-c"+chr$(id)chr$(ml)chr$(mh)sc$ :rem kommando senden
4180 :get#15,fe$:fe=asc(fe$) :rem fehler status holen
4190 close 15
4200 return
4210 :
5000 rem -------------- scann cbm-bus for cmd-hd ------------------
5010 print "suche nach CMD-HD"
5020 :
5030 for ga=8 to 30 :rem geraeteadr. 8 bis 30 testen
5040 : open 15,ga,15 :rem geraet oefnen und gleich wieder
5050 : close 15 :rem schliessen damit st gesetzt wird
5060 : if st<>-128 then begin :rem -128 = device not present
5070 : open 15,ga,15 :rem st=0 geraet ist vorhanden
5080 : print#15,"uj" :rem reset ausloesen
5090 : input#15,fe,fe$ :rem fehler nr und string lesen
5100 : close 15
5110 : if instr(fe$,"cmd hd")>0 then begin
5120 : dv=ga :rem cmd-hd gefunden
5130 : ga=30:fe=0 :rem for-next schleife beenden
5140 : print "CMD-HD ist Drive ";dv;"":print
5150 : bend:else fe=1
5160 : bend
5170 next
5180 return
5190 :
5200 rem --------------- scann scsi-bus for scsi-device --------------------
5210 print "suche nach SCSI-Devices"
5220 dp=48*256 :rem scsi datenpuffer
5230 mh=48:ml=0 :rem h.byte u. l.byte des scsi datenpuffers
5240 :
5250 sd=0:sl=0 :rem scsi id u. lun vorbelegen
5260 :id=sd:lu=sl
5270 :gosub 2000 :rem inquiry
5280 :if fe=0 then begin :rem 1 byte aus puffer lesen
5290 : open 15,dv,15,"m-r"+chr$(ml)+chr$(mh)+chr$(1)
5300 : get#15,ty$:ty=(asc(ty$) and 31) :rem scsi geraeteklasse
5305 : close 15
5310 : if ty=5 then begin :rem cd/drive gefunden
5410 : gosub 2040 :rem test unit ready
5420 : if fe=2 then print:"Unit ist nicht READY":end
5440 : gosub 2080 :rem get capacity
5450 : if fe=0 then begin
5460 : open 15,dv,15,"m-r"+chr$(ml)+chr$(mh)+chr$(8)
5470 : get#15,c3$,c2$,c1$,c0$,l3$,l2$,l1$,l0$ :rem 8 byte lesen
5480 : close 15
5490 : ca=(asc(c3$)*256^3)+(asc(c2$)*256^2)+(asc(c1$)*256)+asc(c0$)+1
5500 : bl=(asc(l3$)*256^3)+(asc(l2$)*256^2)+(asc(l1$)*256)+asc(l0$)-1
5510 : lu=sl:id=sd:sl=7:sd=8
5530 : bend
5540 : bend
5560 :bend
5570 :sl=sl+1:if sl=8 then sl=0:sd=sd+1
5580 if sd<8 then 5260
5590 return
5600 :
6000 rem -------------- clr screen ---------------------------
6010 window 0,0,79,24,1:print chr$(14);
6020 t$="CD-ROM-MON v1.0 (c) by Achim Taege 1997"
6030 print z$
6040 print tab(40-len(t$)/2);"";t$;""
6050 print z$:print:print z$
6060 window 0,21,79,21,0:print chr$(27)+"m";chr$(14);
6070 print z$
6080 return
6090 :
6100 rem ------------- akt screen ----------------------------
6110 window 0,3,79,3,1:print chr$(27)+"m";chr$(14);
6120 print "Akt. Block NR. > ";bn;"<"
6130 print tab(35) "Lesen >Ls Vd Pt Rd<"
6140 return
6150 :
6160 rem ------------- scsi error ausg. ----------------------
6170 window 0,22,39,24,1:print chr$(27)+"m";chr$(14);
6180 print "SCSI-ERROR NR. > ";se;"<"
6190 print "ERROR-CODE > ";right$(hex$(se(0)),2);" <"
6195 print "SENSE-CODES > ";right$(hex$(se(2)),2);".";
6196 print right$(hex$(se(12)),2);".";right$(hex$(se(13)),2);" <"
6197 return
6199 :
6200 rem ------------- init screen ---------------------------
6210 bn=0:fe=0:pu=pu(0)
6220 gosub 6000:gosub 6100:gosub 6160
6230 return
6240 :
6300 rem ------------ print puffer ---------------------------
6310 :
6320 window 6,5,79,20,1:print chr$(27)+"m";chr$(14);
6330 :
6340 :
6350 for a=0 to 255 step 16
6360 :for i=a to a+15
6370 : print right$(hex$(peek(pu+i)),2);" ";
6380 :next
6390 :print "{SHIFT--} ";
6400 :for i=a to a+15
6410 : print chr$(peek(pu(9)+peek(pu+i)));
6420 :next
6430 :print
6440 next
6450 return
6460 :
6500 rem ------------- get block nr --------------------------
6510 window 40,22,79,22,1:print chr$(27)+"m";chr$(14);
6520 input "Block Nr. > ";bn$:if bn$="" then 6500
6530 bn=val(bn$)
6540 if (bn<0 or bn>ca) then 6510
6550 window 40,23,79,23,1
6560 return
6570 :
6600 rem ------------ print pu ascii -------------------------
6610 for by=a to e
6620 :print chr$(peek(pu(9)+peek(pu+by)));
6630 next
6640 return
6650 :
9000 rem ------------- get hd ram ---------------------------
9020 ba=int(bl/256)
9030 open 15,dv,15
9040 for b=0 to ba
9050 :print#15,"m-r"+chr$(ml)+chr$(mh+b)+chr$(0)
9060 :for i=0 to 255:get#15,a$:poke pu(b)+i,asc(a$):next
9070 next
9080 close 15
9100 return
9110 :
10000 rem ------------- read and disp sektor -----------------
10010 gosub 6500
10020 gosub 6100
10030 gosub 2200
10035 if fe=0 then begin
10040 :gosub 9000
10110 :b=0
10120 :pu=pu(b):gosub 6300
10130 :get key x$
10140 :if (x$<>chr$(27) and x$<>chr$(13)) then 10130
10150 :if x$=chr$(13) then begin
10160 : b=b+1
10170 : if b<=ba then 10120
10180 :bend
10185 bend
10190 return
10200 :
49000 rem ----------- vd lesen -------------------------------
49010 bn=16 :rem vd immer ab sektor 16
49020 gosub 6100
49030 gosub 2200 :rem lesen
49040 if fe=0 then begin
49050 :bl=255 :rem nur 256 byte von interesse
49060 :gosub 9000 :rem einlesen
49110 :b=0
49120 :pu=pu(b)-1 :rem -1 weil die bytes ab 1 nummeriert sind
49130 :ca=peek(pu+81)+peek(pu+82)*256+peek(pu+83)*256^2+peek(pu+84)*256^3
49140 :bl=peek(pu+129)+peek(pu+130)*256
49150 :pl=peek(pu+133)+peek(pu+134)*256+peek(pu+135)*256^2+peek(pu+136)*256^3
49160 :ps=peek(pu+141)+peek(pu+142)*256+peek(pu+143)*256^2+peek(pu+144)*256^3
49170 :rs=peek(pu+159)+peek(pu+160)*256+peek(pu+161)*256^2+peek(pu+162)*256^3
49180 :rl=peek(pu+167)+peek(pu+168)*256+peek(pu+169)*256^2+peek(pu+170)*256^3
49190 bend
49200 return
49210 :
50000 rem ----------- vd anzeigen ----------------------------
50010 gosub 49000 :rem vd lesen
50020 if fe=0 then begin
50030 :window 0,5,79,20,1:print chr$(27)+"l";chr$(14);
50040 :print "VD-Type > ";:a=1
50050 :if peek(pu+a)=0 then print "Boot Record"
50060 :if peek(pu+a)=1 then print "Primary VD"
50070 :if peek(pu+a)=2 then print "Supplementary VD"
50080 :if peek(pu+a)=3 then print "Volume Partition VD"
50090 :if peek(pu+a)=255 then print "VD set Terminator"
50100 :print "Identifier > ";:a=2:e=6:gosub 6600:print
50110 :print "Volume ID > ";:a=41:e=72:gosub 6600:print
50120 :print "Belegte Sektoren >";ca
50130 :print "Sektorlaenge >";bl
50140 :print "Pathtable Start >";ps
50150 :print "Pathtable Laenge >";pl
50160 :print "Root Dir Start >";rs
50170 :print "Root Dir Laenge >";rl
50180 :get key x$
50190 :window 0,5,79,20,1
50200 bend
50210 return
50220 :
51000 rem ------------- pathtable lesen ----------------------
51010 gosub 49000 :rem vd lesen
51020 bn=ps :rem ps = pathtable start sektor
51030 gosub 6100
51040 pu=pu(0):vn=1 :rem puffer und nr des ersten verz.
51045 zt=0:va=0:ve=pl:gosub 2200:gosub 9000:rem ersten sektor lesen
51050 window 0,5,79,20,1:print chr$(27)+"l";chr$(14);
51060 gosub 3000:nl=bc :rem erstes byte lesen laenge des namens
51070 if fe=0 then begin
51080 :gosub 3000 :rem byte zwei ist unbelegt
51090 :gosub 3000:d1=bc
51100 :gosub 3000:d2=bc
51110 :gosub 3000:d3=bc
51120 :gosub 3000:d4=bc
51130 :po=d1+d2*256+d3*256^2+d4*256^3
51140 :print "Nr.>";vn;" < Verzeichnislage >";po;"< ";:vn=vn+1
51150 :gosub 3000:d1=bc
51160 :gosub 3000:d2=bc
51170 :po=d1+d2*256:z=8
51180 :print "Parent Dir >";po;"< Name > ";
51190 :for ni=1 to nl
51200 : gosub 3000:print bc$;:z=z+1
51210 :next
51220 :print:if int(z/2)*2<>z then gosub 3000
51230 :goto 51060
51240 bend
51250 get key x$
51260 window 0,5,79,20,1:print chr$(27)+"m";chr$(14);
51270 return
51280 :
52000 rem --------------- dir lesen ------------------------------
52010 gosub 49000 :rem vd lesen
52020 bn=rs :rem rs = rootdir start
52030 gosub 6100
52040 pu=pu(0)
52050 zt=0:va=0:ve=rl:gosub 2200:gosub 9000:rem ersten sektor lesen
52060 window 0,5,79,20,1:print chr$(27)+"l";chr$(14);
52070 gosub 3000:ee=bc :rem el = eintragslaenge
52080 if (fe=0 and ee>0)then begin
52090 :gosub 3000 :rem byte zwei ist unbelegt
52100 :gosub 3000:d1=bc
52110 :gosub 3000:d2=bc
52120 :gosub 3000:d3=bc
52130 :gosub 3000:d4=bc
52140 :po=d1+d2*256+d3*256^2+d4*256^3
52150 :print "Start>";po;"<";
52160 :gosub 3000:gosub 3000:gosub 3000:gosub 3000:rem bytes 7-10 ueberlesen
52170 :gosub 3000:d1=bc
52180 :gosub 3000:d2=bc
52190 :gosub 3000:d3=bc
52200 :gosub 3000:d4=bc
52210 :po=d1+d2*256+d3*256^2+d4*256^3
52220 :print "Laenge>";po;"<";
52230 :gosub 3000:gosub 3000:gosub 3000:gosub 3000:rem bytes 15-18 ueberlesen
52240 :print "vom>";
52250 :gosub 3000:print bc;",";
52260 :gosub 3000:print bc;",";
52270 :gosub 3000:print bc;",";
52280 :gosub 3000:print bc;",";
52290 :gosub 3000:print bc;",";
52300 :gosub 3000:print bc;",";
52310 :gosub 3000:print bc;"<";
52320 :gosub 3000:gosub 3000:gosub 3000:rem bytes 26-28 ueberlesen
52330 :gosub 3000:gosub 3000:gosub 3000:gosub 3000:rem bytes 29-32 ueberlesen
52340 :gosub 3000:nl=bc:z=33 :rem laenge des namens
52350 :print "Name>";
52360 :for i=1 to nl:gosub 3000:print bc$;:z=z+1:next
52370 :print:if int(z/2)*2<>z then gosub 3000
52380 :goto 52070
52390 bend
52400 get key x$
52410 window 0,5,79,20,1:print chr$(27)+"m";chr$(14);
52420 return
52430 :
60000 rem -------------- hauptprg. ---------------------------
60010 :
60020 gosub 5000 :rem scann cbm-bus
60030 if fe>0 then end
60040 gosub 5200 :rem scann scsi-bus
60050 gosub 6200 :rem init screen
60060 window 40,22,79,22,1:print chr$(27)+"m";chr$(14);
60070 input "Aktion Lb/Vd/Pt/Rd > ";in$
60080 :
60090 if in$="l" then gosub 10000
60100 if in$="v" then gosub 50000
60105 if in$="p" then gosub 51000
60110 if in$="r" then gosub 52000
60120 :
60130 :
60200 goto 60060
60210 :
ready.